﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pathfinding;

public class Enemy_TurnAround : MonoBehaviour
{
    private AIBase aIBase;
    private float currentTowardHorizental = -1.0f;

    void Start()
    {
        aIBase = GetComponentInParent<AIBase>();
    }

    void Update()
    {
        if( currentTowardHorizental * aIBase.velocity.x < 0)
        {
            currentTowardHorizental = -currentTowardHorizental;
            transform.Rotate(0, 180, 0);
        }
    }
}
